﻿using ChoMy.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace ChoMy.Areas.Admin.Controllers
{
    [Authorize]
    public class LayoutController : Controller
    {
        public ActionResult ManagerModal(string partialView, string title, string returnListUrl, string controller)
        {
            ViewBag.Title = title;
            ViewBag.ReturnListUrl = returnListUrl;
            ViewBag.Controller = controller;

            return PartialView(partialView);
        }

        public ActionResult Alert(string partialView)
        {
            string userName = User.Identity.Name;

            if (Session["alert-message-" + userName] != null)
            {               
                ViewBag.AlertMessage = Session["alert-message-" + userName];

                ViewBag.AlertType = Session["alert-type-" + userName];

                Session["alert-type-" + userName] = null;

                Session["alert-message-" + userName] = null;

                return PartialView(partialView);
            }

            return null;           
        }
    }
}